The Logic of "OR" and "AND"
Two pillars support the entire field of combinatorics. Their application depends entirely on whether we are viewing a task as a single choice from multiple categories or a sequence of choices.
If a set $X$ is partitioned into disjoint subsets $X_1, X_2, \dots, X_n$, then the total number of elements $|X|$ is the sum of the sizes of those subsets:
$$|X| = |X_1| + |X_2| + \dots + |X_n|$$
Analogy: Choosing a meal at Kay’s Quick Lunch by picking either a sandwich from the Main Course menu OR an appetizer from the Appetizer menu. You cannot have both; you choose one item.
If an activity consists of $t$ successive steps, where step $i$ has $n_i$ possible outcomes, the total number of ways to complete the task is the product of the possibilities at each step:
$$N = n_1 \times n_2 \times \dots \times n_t$$
Analogy: Configuring a "Big Pickup" truck. You must choose an engine (5 options) AND a cab style (3 options). The total configurations equal $5 \times 3 = 15$.
Code Implementation and Complexity
In computer science, these principles manifest in loop structures. Sequential loops represent the Addition Principle, while nested loops represent the Multiplication Principle.
for i = 1 to m: println(i)
for j = 1 to n: println(j)
// Multiplication Principle (m * n executions)
for i = 1 to m:
for j = 1 to n:
println(i, j)